<?php
include ('lib/twitese.php');
delCookie('oauth_token');
delCookie('oauth_token_secret');
delCookie('user_id');
delCookie('twitese_name');
delCookie('twitese_pw');
delCookie('friends_count');
delCookie('statuses_count');
delCookie('followers_count');
delCookie('imgurl');
delCookie('name');
delCookie('listed_count');
delCookie('recover');
delCookie('homeInterval');
delCookie('updatesInterval');
session_destroy();

if(!isset($_SESSION)) {
  session_start();
}
setcookie("login_page", "./index.php");
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="robots" content="noindex,nofollow">
    <link rel="icon" href="img/favicon.ico" />
    <link rel="stylesheet" media="screen" href="css/blueprint/plugins/buttons/screen.css" />
    <link rel="stylesheet" href="css/login2.css" media="screen">
    <title>登录 - <?php echo SITE_NAME ?></title>
  </head>
  <body>
    <div id="container" class="container">
      <header>
        <h1 class="header">
        <?php echo SITE_NAME ?>
        </h1>
      </header>
      <?php if(strpos($_SERVER["HTTP_USER_AGENT"],"MSIE")): ?>
        <div class="not-implement">请使用WebKit Gecko内核的浏览器登录。推荐使用Chrome或Firefox。</div>
      <?php else: ?>
        <section class="left">
          <h2>登录</h2>
          <form id="login" action="oauth.php" method="post">
            <fieldset class="sign-in">
              <div class="row user">
                <input class="text" id="username" name="username" autofocus="autofocus" placeholder="Username or email" pattern="^[A-Za-z0-9\.@_-]+$" required="required" type="text" size="35" />
              </div>
              <div class="row password">
                <input class="password" id="password" name="password" placeholder="Password" required="required" type="password" value="" size="35" />
              </div>
              <?php if(INVITECODE != ""): ?>
              <div class="row">
                <input class="text" id="invitecode" name="invitecode" placeholder="Invitation code" required="required" type="text" value="" size="35" />
              </div>
              <?php endif;?>
              <input id="proxify" name="proxify" type="hidden" value="1">
              <button type="submit" class="button positive">
                <img alt="Login" src="css/blueprint/plugins/buttons/icons/tick.png" />Login
              </button>
            </fieldset>
          </form>
        </section>
        <nav class="permissions">
          <p>This application <strong>will be able to</strong>:</p>
          <ul>
            <li>Read Tweets from your timeline.</li>
            <li>See who you follow, and follow new people.</li>
            <li>Update your profile.</li>
            <li>Post Tweets for you.</li>
          </ul>
        </nav>
      <?php endif; ?>
      <footer>
        This site is supported by <a href="https://twitter.com/#!/<?php echo SITE_OWNER ?>" title="<?php echo SITE_OWNER; ?>" target="_blank"><?php echo SITE_OWNER; ?></a>
       of <a href="<?php echo WEB_SITE; ?>" title="<?php echo SITE_NAME; ?>" target="_blank"><?php echo SITE_NAME; ?></a>.
      </footer>
    </div>
  </body>
</html>
